home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / asmbler.arc / CURSOR.ASM < prev    next >
Assembly Source File  |  1988-11-19  |  2KB  |  70 lines

  1.         title   cursor
  2. COMMENT \
  3. Set the cursor to a blinking block or blinking underline.  Regrettably, 
  4. the blink frequency is not variable, only the vertical size, and the
  5. cursor is stored by BIOS only in an output-only port making it 
  6. impossible for this routine to toggle the current cursor.
  7.  
  8. Usage:  CURSOR [/B] [/U]
  9.  
  10. A block cursor is selected by the switch /B or if no switches are
  11. specified, and an underline cursor by the switch /U.  Only the 
  12. first valid switch found is used in the event that more than one
  13. is specified.
  14.  
  15. [24-Jan-84]     Nelson H.F. Beebe, University of Utah
  16. \
  17.         assume  cs:cursor, ds:cursor, es:cursor, ss:cursor
  18.  
  19. include ascii.inc
  20. include dos.inc
  21.  
  22. cursor  segment para public 'code'
  23.         org     100h            ; this will be a .COM file
  24.  
  25. start:
  26.         mov     si,81h          ; Beginning of parameter line in PSP
  27.         xor     ch,ch           ; Clear top half of cx
  28.         mov     cl,[si-1]       ; Length of parameter line in cx from 80h
  29.         jcxz    setb            ; Skip scan if line empty
  30.         mov     ah,$DOS_SWITCH
  31.         mov     al,$DOS_SWITCH_GET
  32.         int     $DOS            ; Get switch character in dx
  33.  
  34. scan:                           ; scan command line for switches
  35.         lodsb                   ; byte from [si] to al, increment si
  36.         cmp     al,dl           ; switch character?
  37.         jne     test            ; no, keep scanning
  38.         cmp     cx,1            ; more characters?
  39.         jbe     setb            ; no
  40.         lodsb                   ; get switch letter
  41.         cmp     al,'a'          ; convert to upper case
  42.         jb      comp
  43.         cmp     al,'z'
  44.         ja      comp
  45.         and     al,NOT 20h      ; turn off lower-case bit
  46. comp:
  47.         cmp     al,'B'          ; /B?
  48.         je      setb
  49.         cmp     al,'U'          ; /U?
  50.         je      setu
  51. test:   
  52.         loop    scan            ; loop while cx > 0
  53.  
  54. setb:
  55.         mov     cx,000Ch        ; Block cursor in lines 00 .. 0C
  56.         jmp     short set
  57. setu:
  58.         mov     cx,0B0Dh        ; Underline cursor in lines 0B .. 0D
  59.         jmp     short set
  60.  
  61. set:    
  62.         mov     ah,$VIDEO_SETCURSORTYPE
  63.         int     $VIDEO          ; Set the cursor
  64.  
  65.         mov     al,0            ; return code
  66.         mov     ah,$DOS_EXIT
  67.         int     $DOS            ; Exit to DOS
  68. cursor  ends
  69.         end     start
  70.